<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>publish - Community</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <link rel="stylesheet" href="/css/bootstrap-theme.min.css">
    <link rel="stylesheet" href="/css/community.css">
    <link rel="stylesheet" href="/css/editormd.css">
    <link rel="stylesheet" href="//at.alicdn.com/t/font_1758372_iu83tgg8gw.css">
    <script src="/js/jquery-3.4.1.min.js"></script>
    <script src="/js/bootstrap.min.js" type="application/javascript"></script>
    <script src="/js/community.js" type="application/javascript"></script>
    <script src="/js/editormd.min.js" type="application/javascript"></script>
</head>
<body>
<div th:insert="~{navigation :: nav}"></div>
<div class="container-fluid main" >
    <div class="row">
        <div class="col-lg-9 col-md-12 col-sm-12 col-xs-12 page-left">
            <h2 class="headline"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span>publish</h2>
            <hr>

            <form action="/publish" method="post">
                <input type="hidden" name = "id" th:value="${id}">
                <div class="form-group">
                    <label for="title">title(brief)</label>
                    <input type="text" class="form-control" th:value="${title}" id="title" name="title" autocomplete="off" placeholder="input a title">
                </div>
                <div class="form-group" id="question-editor">
                    <label for="title">complete the question(please obey tips)</label>
                    <textarea name="description" id="description" th:text="${description}" style="display:none;" class = "form-control" cols="30" rows="10"></textarea>
                </div>
                <script type="text/javascript">
                    $(function() {
                        var editor = editormd("question-editor", {
                            width  : "100%",
                            height : 350,
                            path   : "/js/lib/",
                            delay  : 0,
                            watch  : false,
                            placeholder : "Please input question description",
                            imageUpload    : true,
                            imageFormats   : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
                            imageUploadURL : "/file/upload",
                        });
                    });
                </script>
                <div class="form-group">
                    <label for="title">AddTag</label>
                    <input type="text" class="form-control" id="tag" th:value="${tag}"
                           name="tag" autocomplete="off" placeholder="input a tag" onclick="showSelectTag()" >
                    <div id="select-tag" class="publish-tag-tab">
                        <!-- Nav tabs -->
                        <ul class="nav nav-tabs" role="tablist">
                            <li role="presentation" th:each="selectCategory,selectCategoryStat: ${tags}">
                                <a th:href="${'#'+selectCategory.getCategoryName()}" aria-controls="home" role="tab"
                                   data-toggle="tab" th:text="${selectCategory.categoryName}"></a>
                            </li>
                        </ul>
                        <!-- Tab panes -->
                        <div class="tab-content">
                            <div role="tabpanel" class="tab-pane" th:id="${selectCategory.categoryName}"
                                 th:each="selectCategory: ${tags}"
                                 th:class="${selectCategoryStat.first ? 'active tab-pane':'tab-pane'}">
                                   <span class="label label-info" th:each="selectTag: ${selectCategory.tags}">
                                        <span class="glyphicon glyphicon-tags" onclick="selectTag(this)" th:data-tag="${selectTag}"  th:text="${' '+selectTag}"></span>
                                   </span>
                            </div>
                        </div>

                    </div>
                </div>


                <div class="container-fluid" main>
                    <div class="row">
                        <div class="col-lg-9 col-md-12 col-sm-12 col-xs-12">
                            <div class = "alert alert-danger col-lg-12 col-md-12 col-sm-12 col-xs-12"
                                th:text="${error}"
                                th:if="${error!= null}">
                            </div>
                        </div>
                        <div class="col-lg-3 col-md-12 col-sm-12 col-xs-12">
                            <button type="submit" class="btn btn-success btn-publish">publish</button>
                        </div>

                    </div>
                </div>

            </form>
        </div>
        <div class="col-lg-3 col-md-12 col-sm-12 col-xs-12">
            <h3>QuestionGuide</h3>
            • Questions title: please describe the problem you posted in a concise language<br>
            • Question supplement: supplement your question in detail<br>
            • Select tags: select one or more appropriate tags, separated by commas<br>
        </div>
    </div>
</div>
<div th:insert="~{footer :: foot}"></div>
</body>
</html>